"""配置文件工具"""
import json
import os
from config.settings import Config
from common.tools.out import out


def get_config():
    """读取配置文件"""
    if not os.path.exists(Config.CONFIG_FILE):
        print('│ 读取配置文件失败，请先创建配置文件')
        out()
    try:
        with open(Config.CONFIG_FILE, encoding='utf-8') as f:
            config = json.load(f)
        return config
    except json.decoder.JSONDecodeError:
        print('│ 配置文件错误，请检查配置文件')
        out()
